package com.mao.jxc.admin.config;

import com.mao.jxc.admin.interceptor.NoLoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author: Administrator
 * @description:
 * @cteate 2021-07-21-22:29
 */
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Bean
    public NoLoginInterceptor noLoginInterceptor(){
        return new NoLoginInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(noLoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/index",
                        "/user/login",
                        "/signout",
                        "/css/**",
                        "/error/**",
                        "/images/**",
                        "/js/**",
                        "/lib/**");
    }
}
